package com.hddz.comlib.util;

import java.io.File;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Environment;

public class BaseUtility {
	public static String getSDPath() {
		File sdDir = null;
		boolean sdCardExist = Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED); // 判断sd卡是否存在
		if (sdCardExist) {
			sdDir = Environment.getExternalStorageDirectory();// 获取跟目录
		}
		return sdDir.toString();

	}
	
	public static boolean isWifiNet(Context context){
	    if (context != null) {
	        ConnectivityManager mConnectivityManager = (ConnectivityManager) context
	                .getSystemService(Context.CONNECTIVITY_SERVICE);
	        NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkInfo();
	        //1.判断是否有网络连接 
	        boolean networkAvailable = networkInfo.isAvailable();
	        //2.获取当前网络连接的类型信息
	        int networkType = networkInfo.getType();
	        if(ConnectivityManager.TYPE_WIFI == networkType){
	            return true;
	        }
	    }
	    return false;
	}
	
}
